<?php
// +----------------------------------------------------------------------
// |renameFile.php
// +----------------------------------------------------------------------
// |Data:2016-04-18 下午1:56
// +----------------------------------------------------------------------
// |Author: 吕志雄 <870923001@qq.com>
// +----------------------------------------------------------------------

require 'Common.php';

$key = $_POST['key'];
$akey = $_POST['akey'];
$skey = $_POST['skey'];
$sig = $_POST['sig'];
$alias = $_POST['alias'];
$new = $_POST['new'];
$old = $_POST['old'];

if(empty($key) || empty($akey) || empty($skey) || empty($sig) || empty($new) || empty($old))
{
    throw new Exception("",'REMOTE_KEY');
}

$config_key = C('UPLOAD')['REMOTE_KEY'];
if($akey!=$config_key){
    throw new Exception("",'invalid_request_key');
}

$upload = new Upload();
$ret = $upload->rename($alias,$old,$new);
exit(json_encode($ret));

?>